package com.lvmama.monkey.entrance

import com.lvmama.monkey.analysis._
import com.lvmama.monkey.buy._
import com.lvmama.monkey.calcula.PurchasingPowerCalcula

/**
  * Created by hejing on 2017/10/12.
  */
object JobExecute {
  def main(args: Array[String]): Unit = {
    System.setProperty("HADOOP_USER_NAME","hdfs")
    //System.setProperty("HADOOP_CONF_DIR","10.200.2.104:/usr/hadoop")

    val jobs: Option[String] => Unit = {
      //好评率预测——1.提取字段，处理后作为训练集数据，saveAsTextFile存入到hdfs
      case Some("ChooseCommentTrainData") => ChooseCommentTrainData()
      //好评率预测——2.提取字段，处理后作为预测集数据，存入到mysql
      case Some("CreateCommentPredictData") => CreateCommentPredictData()
      //好评率预测——3.预测评价
      case Some("CommentPredictJob") => CommentPredictJob()

      //购买力预测——1.提取字段，处理后作为训练集数据，saveAsTextFile存入到hdfs
      case Some("ChoosePurchasingTrainData") => ChoosePurchasingTrainData()
      //购买力预测——2.提取字段，处理后作为预测集数据，存入到mysql
      case Some("CreatePurchasingPredictData") => CreatePurchasingPredictData()
      //购买力预测——3.预测购买力
      case Some("PurchasingPower") => PurchasingPower()
      //逻辑处理job
      case Some("PurchasingPowerCalcula") => PurchasingPowerCalcula()

      case _ => println("monkey-Spark no job to execute !!!!!!!")
    }
    jobs(Option[String](args.head))
    System.exit(0)
  }

}